package tech.aistar.service.order;

import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;
import tech.aistar.entity.DemandOrder;
import tech.aistar.vo.DemandOrderVo;

import java.util.List;

/**
 * Created by 23827 on 2019/9/28.
 */
@Service
public interface IDemandOrderService {
    //    查询所有的

    @Select("select * from demand_order")
    List<DemandOrder> findAll();

    //    通过id查询
    @Select("select * from demand_order where id = #{value}")
    List<DemandOrder> getById(Integer id);


//    通过服务订单的订单编号和名称进行查找

    @Select("select * from demand_order where order_number like concat('%',#{order_number},'%')")
    List<DemandOrder> find(String order_number);

//    删除

    @Update("update demand_order set status = 0 where id = #{value}")
    DemandOrder delById(Integer id);

//    添加

    DemandOrder insertDemandOrder(DemandOrder demandOrder);

    //    更新
    void updateDemandOrder(DemandOrder demandOrder);


    //通过订单状态查询该条订单全部
    @Select("select * from demand_order where status = #{value}")
    List<DemandOrder> getByStatus(Integer status);

    //第三方式实体类
    List<DemandOrderVo> demandOrderVo();

//    //第三方实体类根据id删除
//    DemandOrder delGetById(Map<Integer,Object> updateIdMap);


    /**
     * 多条件组合查询+分页
     * @param order_number
     * @param pageNum 当前页
     * @param pageSize 每页显示条数
     * @return
     */
    PageInfo<DemandOrder> findAll(String order_number, Integer pageNum, Integer pageSize);

}
